package demo3;
import java.util.HashSet;

public class SetUniquenessVerification {
    public static void main(String[] args) {
        HashSet<String> strings = new HashSet<>();
        int initialSize = strings.size();
        strings.add("apple");
        strings.add("banana");
        strings.add("apple");
        int finalSize = strings.size();
        boolean hasDuplicates = initialSize + 3 != finalSize;
        System.out.println("集合中是否存在重复元素: " + hasDuplicates);
    }
}
